﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="CommitFixReport.aspx.cs" Inherits="CentalineWeb.CommitFixReport" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cpHead" runat="server">
    <title></title>
    <style type="text/css">
        .container{ text-align: center; text-align:-moz-center;padding-top: 100px;}
        .button
        {
            color:black;
            border: 1px solid #96C2F1;
            line-height: 16px;
            background: url("Images/button_bg.gif");
            width: 47px;
            margin-top:  10px;
            
        }
    </style>
    <script type="text/javascript" src="scripts/hazipinyin.js"></script>
    <script type="text/javascript">
        var tree;
        var curnode;
        $(function(){
            //  $("#txtAddress").attr("data-options", "data:<%=DeptListJson%>");
            //读取部门信息
            $("#txtAddress").combotree({
                data: <%=DeptListJson%>,
                required:true,
                editable:true,
                missingMessage:"请选择所在分行!",
                onClick: function(node) {
                    $("#txtAddress").val(node.text);
                }
            });
            //快速定位部门
            var v1 = $("#txtAddress").combo("textbox")[0];
            tree = $("#txtAddress").combotree("tree");
            $(v1).on("keydown",function(event) {
                if (event.keyCode == 13) {
                    $("#txtAddress").combotree("setValue", curnode.id);
                    $("#txtAddress").val(curnode.id);
                    $("#txtAddress").combo("hidePanel");
                    return false;
                }
            });
            //获取一组汉字的首字母 小写
            $(v1).on("keyup", function() {
                var word = $(this).val().toLowerCase().trim();
                $.each(tree.tree("getRoots"), function(index,node) {
                    var pinyin=  makePy(node.text)[0].toLowerCase();
                    if (pinyin.indexOf(word) != -1) {
                        tree.tree("select", node.target);
                        tree.tree("scrollTo", node.target);
                        curnode = node;
                        return false;
                    }
                    search(node, word);
                });

            });
            
        });

        function search(node, str) {
            var children = tree.tree("getChildren", node.target);
            
            $.each(children, function(index, ele) {
                var pinyin=  makePy(ele.text)[0].toLowerCase();
                if (pinyin.indexOf(str) != -1) {
                    tree.tree("select", ele.target);
                    tree.tree("scrollTo", ele.target);
                    curnode = ele;
                    return false;
                }
                search(ele, str);
            });
        }
        //输入验证
        function validate() {
            if ($("#ddlArticle option:selected").text() == "==请选择==") {
                alert("请选择报修种类!"); 
                return false;
            }
            if ($("#txtAddress").val() == "") {
                alert("请选择分行!"); 
                return false;
            }
            if ($("#txtNumber").val().trim() == "") {
                alert("请输入电脑编号!"); 
                return false;
            }
            if ($("#txtStaff").val().trim() == "") {
                alert("请输入报修人员!"); 
                return false;
            }
            var reg = /^([a-zA-Z0-9_\.\-])+(@centaline.com.cn)$/;
            if (!reg.test($("#txtMail").val().trim())) {
                alert("请输入正确的邮箱格式! 如：xxx@centaline.com.cn"); 
                return false;
            }
            var reg = /^(130|131|132|133|134|135|136|137|138|139)\d{8}$/;
            if (!reg.test($("#txtPhone").val().trim())) {
                alert("请输入正确的电话号码!"); 
                return false;
            }
        };
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpContent" runat="server">
        <table class="table1">
        <tr>
            <td>报修种类：</td>
            <td><asp:DropDownList ID="ddlArticle" runat="server" ClientIDMode="Static" ></asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td>所在分行：</td>
            <td>
                	<asp:TextBox ID="txtAddress" Text="" style="width:400px;" runat="server" ClientIDMode="Static"  />
            </td>
        </tr>
        <tr>
            <td>电脑编号：</td>
            <td>
                <asp:TextBox ID="txtNumber" ClientIDMode="Static" runat="server" class="easyui-validatebox textbox validatebox-text validatebox-invalid" data-options="required:true, missingMessage:'请输入电脑编号'"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>故障描述：</td>
            <td>
                <asp:TextBox ID="txtDesc" TextMode="MultiLine" runat="server"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>报修人员：</td>
            <td>
                <asp:TextBox ID="txtStaff" ClientIDMode="Static"  runat="server" ReadOnly="True" CssClass="easyui-validatebox textbox alidatebox-text" data-options="required:true" Text="test"></asp:TextBox>
               
            </td>
        </tr>
        <tr>
            <td>电子邮箱：</td>
            <td>
                <asp:TextBox ID="txtMail" ClientIDMode="Static"  runat="server" class="easyui-validatebox textbox" data-options="required:true, missingMessage:'请输入公司邮箱'"></asp:TextBox>
               </td>
        </tr>
        <tr>
            <td>联系电话：</td>
            <td>
                <asp:TextBox ID="txtPhone" ClientIDMode="Static"  runat="server" class="easyui-validatebox textbox" data-options="required:true, missingMessage:'请输入联系电话'"></asp:TextBox>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Button ID="btnSubmit" runat="server"  CssClass="button" Text="提交" OnClick="btnSubmit_Click" ValidationGroup="a" OnClientClick="return validate()" /></td>
            <td>
                <asp:Button ID="btnRewrite" runat="server" CssClass="button" Text="重写" OnClick="btnRewrite_Click" /></td>
        </tr>
    </table>
</asp:Content>
